package com.cleverdevices.kevin;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class StartingPoint extends Activity {
	/** Called when the activity is first created. */
	
	// CREATING VIEW ITEMS
	int counter;
	Button add, subtract;
	TextView display;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.starting_point);
        counter = 0;
        
        // connects the XML layout objects to Java objects
        add = (Button)findViewById(R.id.bAdd);
        subtract = (Button)findViewById(R.id.bSubtract);
        display = (TextView)findViewById(R.id.tvDisplay);
        
        // SET LISTENERS FOR THE BUTTONS
        add.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				counter++;
				display.setText("The total is " + counter);
			}
		});
        
        subtract.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				counter--;
				display.setText("The total is " + counter);
			}
		});
        
        
    }
    
    

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.starting_point, menu);
        return true;
    }

    
}
